import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: 'home'
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/Home.vue'),
      meta: { isShow: true },
      // 二级路由
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login.vue'),
      meta: { isShow: false },
      // 二级路由
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/Register.vue'),
      meta: { isShow: false },
      // 二级路由
    },
    {
      path: '/code',
      name: 'code',
      component: () => import('@/views/Code.vue'),
      meta: { isShow: false },
    },
    {
      path: '/password',
      name: 'password',
      component: () => import('@/views/Password.vue'),
      meta: { isShow: false },
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('@/views/Search.vue'),
      meta: { isShow: false },
    },
    {
      path: '/mine',
      name: 'mine',
      component: () => import('@/views/Mine.vue'),
      meta: { isShow: true },
      // 二级路由
    },
    {
      path: '/cart',
      name: 'cart',
      component: () => import('@/views/Cart.vue'),
      meta: { isShow: true },

    },
    {
      path: '/pay',
      name: 'pay',
      component: () => import('@/views/Pay.vue'),
      meta: { isShow: false },
      // 二级路由
    },
    {
      path: '/address',
      name: 'address',
      component: () => import('@/views/Address.vue'),
      meta: { isShow: false },
      // 二级路由
    },
    {
      path: '/goodsOrder',
      name: 'goodsOrder',
      component: () => import('@/views/GoodsOrder.vue'),
      meta: { isShow: false },

      // 二级路由
    },
    {
      path: '/detail/:proid',
      name: 'detail',
      component: () => import('@/views/Detail.vue'),
      meta: { isShow: false },

      // 二级路由
    }

  ]
})

export default router
